import React from 'react';
import {WeaSearchGroup,WeaFormItem,WeaCheckbox} from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import EType from './base/EType';
import ETitle from './base/ETitle';

// 审批助手元素
export default class Content_fnaBudgetAssistant1 extends React.Component {
    state = {
        eDepartment: this.props.eDepartment || 0,
        eBranch: this.props.eBranch || 0,
        ePersonal: this.props.ePersonal || 0,
        eCostCenter: this.props.eCostCenter || 0,
    };
    render() {
    const { eDepartment, eBranch, ePersonal, eCostCenter } = this.state;
    let EDepartment = (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@epm1xl`} label={getLabel(6087, '个人')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@xq30ox`} value={eDepartment} onChange={(value)=>this.setState({eDepartment: value})}/>
            </WeaFormItem>
        );
    let EBranch = (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@uwygln`} label={getLabel(27511	, '部门')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@lz1827`} value={eBranch} onChange={(value)=>this.setState({eBranch: value})}/>
            </WeaFormItem>
        );
    let EPersonal = (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@0z5tya`} label={getLabel(33553, '分部')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@cemhvk`} value={ePersonal} onChange={(value)=>this.setState({ePersonal: value})}/>
            </WeaFormItem>
        );
    let ECostCenter = (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@bi8fp6`} label={getLabel(515, '成本中心')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@8bf3py`} value={eCostCenter} onChange={(value)=>this.setState({eCostCenter: value})}/>
            </WeaFormItem>
        );

        return (
            <div>
                <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@ufsar2`} title={getLabel(81711, '基本信息')} needTigger={true} showGroup={true}>
                    <EType ecId={`${this && this.props && this.props.ecId || ''}_EType@2xcrw8`} ref="eType" value={this.props.eBaseName}/>
                    {this.props.eShareLevel == '2' ? <ETitle ecId={`${this && this.props && this.props.ecId || ''}_ETitle@zm7he2`} ref="eTitle" eid={this.props.eid} value={this.props.eTitle} {...this.props}/> : ''}
                    {EDepartment}
                    {EBranch}
                    {EPersonal}
                    {ECostCenter}
                </WeaSearchGroup>
            </div>
        );
    }

    getSaveValues() {
        return {
            eContentTitle: this.refs['eTitle'] ? this.refs['eTitle'].getSaveValues() : this.props.eTitle,
            eContentDepartment: this.state.eDepartment,
            eContentBranch: this.state.eBranch,
            ContentPersonal: this.state.ePersonal,
            ContentCostCenter: this.state.eCostCenter,
        };
    }
}